<?php

use think\facade\Route;

//miss路由，定义404
Route::miss(function () {
    @header("http/1.1 404 not found");
    @header("status: 404 not found");
    exit();
});
/**
 * 首页数据/协议
 */
Route::group('index', function () {
    Route::get('/getList', 'index/getList');
    Route::get('/getCateList', 'index/getCateList');
    Route::get('/communal', 'index/communal');
})->allowCrossDomain();
/**
 * 回调
 */
Route::group('callback', function () {
    Route::rule('/autoOssBackup', 'callback/autoOssBackup');
    Route::rule('/statistics', 'callback/statistics');
    Route::rule('/autoRelease', 'callback/autoRelease');
    Route::rule('/autoDividend', 'callback/autoDividend');
})->allowCrossDomain();
/**
 * 公告
 */
Route::group('news', function () {
    Route::get('/getList', 'news/getList');
    Route::get('/info', 'news/info');
})->allowCrossDomain()->middleware('verify');
/**
 * 商品列表
 */
Route::group('product', function () {
    Route::get('/getList', 'product/getList');
    Route::get('/details', 'product/details');
    Route::post('/submit', 'product/submit');
})->allowCrossDomain()->middleware('verify');
/**
 * 订单中心
 */
Route::group('order', function () {
    Route::get('/index', 'order/index');
    Route::get('/getList', 'order/getList');
    Route::get('/my_order_details', 'order/my_order_details');
    Route::get('/payment', 'order/payment');
    Route::post('/submit', 'order/submit');
    Route::post('/edit', 'order/edit');
    Route::post('/confirmPayment', 'order/confirmPayment');
})->allowCrossDomain()->middleware('verify');
/**
 * 收货地址
 */
Route::group('address', function () {
    Route::get('/getList', 'address/getList');
    Route::get('/details', 'address/details');
    Route::get('/getArea', 'address/getArea');
    Route::post('/save', 'address/save');
    Route::post('/edit', 'address/edit');
})->allowCrossDomain()->middleware('verify');
/**
 * 用户中心
 */
Route::group('user', function () {
    Route::get('/userInfo', 'user/userInfo');
    Route::get('/myTaem', 'user/myTaem');
    Route::get('/getAccountList', 'user/getAccountList');
    Route::post('/edit', 'user/edit');
    Route::post('/editPassword', 'user/editPassword');
    Route::post('/savePayment', 'user/savePayment');
})->allowCrossDomain()->middleware('verify');
/**
 * 兑换记录
 */
Route::group('draw', function () {
    Route::get('/detail', 'draw/detail');
    Route::get('/getList', 'draw/getList');
    Route::post('/save', 'draw/save');
})->allowCrossDomain()->middleware('verify');
/**
 * 充值管理
 */
Route::group('remit', function () {
    Route::get('/remitInfo', 'remit/remitInfo');
    Route::get('/getList', 'remit/getList');
    Route::post('/save', 'remit/save');
})->allowCrossDomain()->middleware('verify');
/**
 * 注册登录
 */
Route::group('login', function () {
    Route::post('/register', 'login/register');
    Route::post('/check', 'login/check');
})->allowCrossDomain();
//互转相关
Route::group('transfer', function () {
    Route::get('/getAccount', 'transfer/getAccount');
    Route::get('/getList', 'transfer/getList');
    Route::get('/verify', 'transfer/verify');
    Route::post('/save', 'transfer/save');
})->allowCrossDomain()->middleware('verify');
/**
 * 上传图片
 */
Route::group('uploads', function () {
    Route::rule('/uploadImage', 'uploads/uploadImage');
})->allowCrossDomain();
